package com.huihui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import com.huihui.R;
import com.huihui.adapter.MyPagerAdapter;
import com.huihui.base.BaseActivity;

import java.util.List;

public class PreviewAcitivty extends BaseActivity {

    private List<String> mList;
    private int currentPosition;
    MyPagerAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_preview_acitivty);
//        getSupportActionBar().setTitle("图片详情");
        titleView.setText("图片详情");
        getIntentData();
        initView();
    }

    private void getIntentData() {
        Intent intent = getIntent();
        mList = (List<String>) intent.getSerializableExtra("photoList");
        currentPosition = intent.getIntExtra("position",0);

    }

    private void initView() {
        ViewPager viewPager = findViewById(R.id.image_viewPager);
         adapter = new MyPagerAdapter(this,mList);
        viewPager.setAdapter(adapter);
        viewPager.setCurrentItem(currentPosition);
    }

}
